<template>
	<view class="formpanel">
		<form @submit="formSubmit">
			<view class="group border-tb">账户信息</view>
			<view class="cu-form-group border-b">
				<view class="title">个人头像</view>
				<view class="text"><image :src="Info.HeadImg"/></view>
			</view>
			<view class="cu-form-group border-b">
				<view class="title">账户昵称</view>
				<view class="text"><input name="NickName" type="text" placeholder="请输入账户昵称" placeholder-class="gray" :value="Info.NickName"></input></view>
			</view>
			<view class="cu-form-group border-b">
				<view class="title">选择性别</view>
				<view class="text">
					<radio-group name="Sex">
						<label><view class="r1"><radio value="男" :checked="Info.Sex=='男'?true:false" color="#3d7dfd" /></view><view class="r2">男</view></label>
						<label><view class="r1"><radio value="女" :checked="Info.Sex=='女'?true:false" color="#3d7dfd" /></view><view class="r2">女</view></label>
					</radio-group>
				</view>
			</view>
			<view class="cu-form-group border-b">
				<view class="title">手机号码</view>
				<view class="text"><input name="Mobile" type="number" placeholder="请输入手机号码" placeholder-class="gray" :value="Info.Mobile"></input></view>
			</view>
			
			<view class="btn">
				<button class="publishs" form-type="submit">保存</button>
			</view>
		</form>
	</view> 
</template>

<script>
	export default {
		data() {
			return {
				Info:{ID:0, CarNum:''}
			};
		},
		onLoad() {
			this.Find_MemberInfo();
		},
		methods:{
			Find_MemberInfo(){
				var data = {};
				data.ID=this.ID;
				data.Act="Find_MemberInfo";
				this.Util.Loading("加载中...");
				this.Util.Member(data, json=>{
					this.Util.HideLoading();
					uni.stopPullDownRefresh();
					uni.hideNavigationBarLoading();
					this.Info = json.Data.Info;
				});
			},
			
			formSubmit(e){
				var data = e.detail.value;
				data.Act="Save_Member";
				data.ID=this.ID;
				if(data.NickName.Trim()==""){
					this.Util.Toast("请输入账户昵称");
					return;
				}
				this.Util.Confirm("您确定要保存吗？",()=>{
					this.Util.Loading("请稍候...");
					this.Save(data);
				});
			},
			Save(data){
				this.Util.Member(data, json=>{
					this.Util.HideLoading();
					if(json.State){
						this.Util.Toast(json.Msg, obj=>{
							uni.$emit("Success","");
							uni.navigateBack();
						});
					}else{
						this.Util.Alert(json.Msg);
					}
				});
			}
		}
	}
</script>

<style lang="scss">
	.group{width:100%; height:80rpx; line-height: 80rpx; padding-left:30rpx; font-size:32rpx; margin-top:25rpx; color:#3d7dfd; background-color: #ffffff;
		.number{color:#000000; padding-right:30rpx; float:right;}
		.resign{color:#00c1a8; padding-right:30rpx; float:right;}
	}
	.title text{color:red;}
	.text{text-align: right;}
	.text radio-group{float:right;}
	label{width:auto; margin-right: 20rpx; display: flex; flex-direction: row; .r1{margin-top:-2rpx;}}
	radio{transform:scale(0.8);}
	.icon{width:60rpx; height:100rpx; image{border-radius:0rpx; width:60rpx; height: 60rpx; margin-top:20rpx;}}
	.line{font-size:34rpx; .datatime{color:#a9a8a8 !important;}}
</style>
